Skip to content

[Store] Allow id to be int|string|Uuid for VectorDocument and TextDocument#867

Closed
MolloKhan wants to merge 152 commits intosymfony:mainfrom
MolloKhan:vectordocument-support-types
Closed

[Store] Allow id to be int|string|Uuid for VectorDocument and TextDocument#867
MolloKhan wants to merge 152 commits intosymfony:mainfrom
MolloKhan:vectordocument-support-types

Conversation

@MolloKhan
Copy link
Copy Markdown
Contributor

Q A
Bug fix? no
New feature? yes
Docs? no
Issues Fix #857
License MIT

I gave this a second thought, and I think @OskarStark idea is the way to go (#857 (comment))
If the ID coming from the store is in Uuid format the user will likely cast it themself

If you are ok with my changes, I'll proceed to update all the places where VectorDocuments are instantiated

@carsonbot carsonbot added Feature New feature Store Issues & PRs about the AI Store component Status: Needs Review labels Nov 14, 2025
@chr-hertel
Copy link
Copy Markdown
Member

that should also be changed in TextDocument than, right?

Comment thread src/store/src/Document/VectorDocument.php Outdated
@MolloKhan
Copy link
Copy Markdown
Contributor Author

I think this is it

Copy link
Copy Markdown
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue we have now is for users not using the Uid component but receiving Uuid instances even if they used string before.

I think the best solution here is to just drop the dependency to the component. no feature of the component itself - besides the type-declaration - actually needs a Uuid and it was a wrong assumption of mine in the beginning based on starting with Pinecone as store 🙈

@MolloKhan
Copy link
Copy Markdown
Contributor Author

Good thinking. I'd need only to remove the Uuid auto-casting from the constructor, right?

@MolloKhan
Copy link
Copy Markdown
Contributor Author

I removed the Uuid auto-casting and only left the type declaration

@OskarStark OskarStark changed the title [Store] VectorDocument Id Support More Types [Store] Allow id to be int|string|Uuid for VectorDocument and TextDocument Nov 19, 2025
@OskarStark
Copy link
Copy Markdown
Contributor

Can we simplify something in the demo/ folder? Or not needed?

@chr-hertel
Copy link
Copy Markdown
Member

Can we simplify something in the demo/ folder? Or not needed?

wouldn't know what, don't think so.

but i think a valid follow up would be to kill UUID dependency in store component

Copy link
Copy Markdown
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please rebase this once and have another look at MongoDb, Weaviate, Typesense, Milvus, MariaDb, and Meilisearch?

I think your changes in bridge implementations for removing the Uuid::fromString(...) make sense, but is not done everywhere.

Thanks already @MolloKhan!

@OskarStark
Copy link
Copy Markdown
Contributor

friendly ping @MolloKhan

@MolloKhan
Copy link
Copy Markdown
Contributor Author

MolloKhan commented Dec 11, 2025

Sorry for the delay! I just got back home from holidays (it was such a long ride 😄) - I searched for all places where we cast strings into uuid and the last place is this one (which looks unrelated to me) Symfony\AI\Store\Document\Loader\RssFeedLoader

@MolloKhan MolloKhan force-pushed the vectordocument-support-types branch from 0b8cd10 to 59de316 Compare December 19, 2025 18:56
@MolloKhan MolloKhan force-pushed the vectordocument-support-types branch from 7e8e863 to 7f9ed01 Compare January 12, 2026 19:53
Comment thread .php-cs-fixer.dist.php Outdated
@MolloKhan
Copy link
Copy Markdown
Contributor Author

I don't know why the PR history shows a long list of commits, but I think this one is ready

@OskarStark
Copy link
Copy Markdown
Contributor

We can check if everything works by require 0.3 for store bridges in demo/composer.json file and populate the store like described in the demo/README.md

@MolloKhan
Copy link
Copy Markdown
Contributor Author

I installed the demo and made it require symfony/ai-chroma-db-store:0.3, it worked well, but it's not using my changes to the ai-store component. I'm not sure how to make the demo use my local changes to that component because I forked the whole symfony/ai repository

@OskarStark
Copy link
Copy Markdown
Contributor

Just require it an push, the CI will use your new code.

On local you can use the link binary in the root of the project.

@MolloKhan
Copy link
Copy Markdown
Contributor Author

Ohh cool! I wasn't aware of the link binary

@MolloKhan
Copy link
Copy Markdown
Contributor Author

Alright, this is working locally, and tests are passing

Copy link
Copy Markdown
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @MolloKhan! 🙏

@chr-hertel
Copy link
Copy Markdown
Member

Reviewed & tested, but cannot merge with this history - running into conflicts. I guess due to unrelated commits on the branch. Could you please isolate your patch again?

Copy link
Copy Markdown
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs a note in the CHANGELOG for store component 0.3 please

@MolloKhan
Copy link
Copy Markdown
Contributor Author

I surely screwed up something when rebasing. I'll create a clean PR

@MolloKhan
Copy link
Copy Markdown
Contributor Author

Closing in favor #1397

@MolloKhan MolloKhan closed this Jan 15, 2026
@MolloKhan MolloKhan deleted the vectordocument-support-types branch January 15, 2026 00:49
chr-hertel added a commit that referenced this pull request Jan 17, 2026
…ocument` and `TextDocument` (MolloKhan)

This PR was squashed before being merged into the main branch.

Discussion
----------

[Store] Allow `id` to be `int|string|Uuid` for `VectorDocument` and `TextDocument`

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| Docs?         | no
| Issues        | Fix #857
| License       | MIT

This PR is a duplicate of #867 but with a clean commit history

Commits
-------

263b7ed [Store] Allow `id` to be `int|string|Uuid` for `VectorDocument` and `TextDocument`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature Status: Needs Review Store Issues & PRs about the AI Store component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Store] Allow VectorDocument ID to be a string